﻿let data = [70, 34, 60, 78, 69, 95, 40, 50, 70, 95];
let titlename = ['北京分行', '上海分行', '广州分行', '深圳分行', '珠海分行',
    '浙江分行', '江苏分行', '武汉分行', '兰州分行', '成都分行'
];
let valdata = [683, 234, 234, 523, 345, 653, 677, 343, 635, 435];
option = {
    backgroundColor: '#081534',
    title: {
        text: '各分行占比',
        show: true,
        textStyle: {
            color: '#ffffff',
            fontSize: 18
        }
    },
    tooltip: {
        trigger: 'axis',
        formatter: function(c) {
            let d;
            for (let i = 0; i < c.length; i++) {
                if (c[i].axisIndex === 0) {
                    d = c[i].axisValue + ' : ' + c[i].data + '%';
                }
            }
            return d;
        },
        axisPointer: {
            type: 'shadow'
        }
    },
    xAxis: {
        show: false
    },
    yAxis: [{
        show: true,
        data: titlename,
        inverse: true,
        max: 10,
        axisLabel: {
            textStyle: {
                fontSize: 12,
                color: '#fff'
            }
        },
        axisLine: {
            show: false
        },
        splitLine: {
            show: false
        },
        axisTick: {
            show: false
        }
    }, {
        show: true,
        inverse: true,
        data: valdata,
        max: 10,
        axisLabel: {
            textStyle: {
                fontSize: 12,
                color: '#fff'
            }
        },
        axisLine: {
            show: false
        },
        splitLine: {
            show: false
        },
        axisTick: {
            show: false
        }
    }],
    series: [{
        name: '条',
        type: 'bar',
        yAxisIndex: 0,
        data: data,
        barWidth: 30,
        itemStyle: {
            normal: {
                color: '#2835B8',
                barBorderRadius: [0, 15, 15, 0]
            }
        },
        label: {
            normal: {
                show: true,
                position: 'inside',
                formatter: '{c}%'
            }
        },
        z: 100
    }, {
        name: '框',
        type: 'bar',
        yAxisIndex: 1,
        data: [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
        barWidth: 30,
        itemStyle: {
            normal: {
                color: 'rgba(18,30,60,0.1)', //整条进度条改为半透明就可以解决位置被覆盖的问题
                borderColor: '#121E3C',
                barBorderRadius: [0, 15, 15, 0]
            }
        },
        label: {
            normal: {
                show: false
            }
        },
        z: 101
    }]
};
